﻿using System;

namespace fund
{
    public static class Utility
    {
        //将时间变成数字
        public static long GetIntFromTime(DateTime dt)
        {
            long lLeft = 621355968000000000;
            DateTime dt1 = dt.ToUniversalTime();
            long Sticks = (dt1.Ticks - lLeft) / 10000000;
            return Sticks;
        }

        /// <summary>
        /// C#获取JS的GetTime()相同的值
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static long GetTimeLikeJS(DateTime dt)
        {
            Int64 retval = 0;
            DateTime st = new DateTime(1970, 1, 1);
            TimeSpan t = (dt.ToUniversalTime() - st);
            retval = (Int64)(t.TotalMilliseconds + 0.5);
            return retval;
        }
    }
}